<?php

class FileManagerItemBuilder
{
    protected $_itemImageClass = 'FileManagerItemImage';
    protected $_itemAudioClass = 'FileManagerItemAudio';
    protected $_item = 'FileManagerItem';
    
	public function &build($type, $options)
	{
		$type = explode("/",$type);
		switch($type[0]) // generic type comes first!
		{
			case "image": $c = $this->_itemImageClass; break;
			case "audio": $c = $this->_itemAudioClass; break;
			default: $c = $this->_item;
		}
		$fmi = new $c($options);
		$fmi->title = $options['title'];
		$fmi->description = $options['description'];
		return $fmi;
	}
}

?>
